/*
 * Stg01Venenosa.cpp
 *
 *  Created on: Jan 14, 2013
 *      Author: raysue
 */

#include "game/stages/Stg01Venenosa.h"
#include "game/towers/Catodix.h"
#include "game/entities/Wave.h"
#include <iostream>

using namespace eats_core;
using namespace std;

Stg_01_Venenosa::Stg_01_Venenosa(std::string mapLocation):EatsStage(mapLocation) {
	goldMeter = 150;
	nemliniumOnStock = 8;

	tempoPrimeiraWave = 15000;
	tempoAnterior = SDL_GetTicks();

	_totalTime = 30000;

}

Stg_01_Venenosa::~Stg_01_Venenosa() {
	// TODO Auto-generated destructor stub
}

bool Stg_01_Venenosa::setUp()
{
	bool ret = true;
	ret = ret && loadAndEnableEnemies();
	return EatsStage::setUp();
}

bool Stg_01_Venenosa::render()
{
	return EatsStage::render();
}

void Stg_01_Venenosa::update()
{
	if(tempoAnterior + tempoPrimeiraWave < SDL_GetTicks()) {
		_wave2->_isActive = true;
	}
	if(7000+tempoAnterior + tempoPrimeiraWave < SDL_GetTicks()) {
		_wave3->_isActive = true;
	}
	EatsStage::update();
}

bool Stg_01_Venenosa::loadAndEnableEnemies() {

	Matusquela * _enemigo_amigo, * _enemigo_amigo1, * _enemigo_amigo2;

	_waveHolder = new WaveHolder(_working_surface);

	_wave = new Wave(_working_surface, 10000, 500);
	_wave2 = new Wave(_working_surface, 10000, 200);
	_wave3 = new Wave(_working_surface, 10000, 100);


	for(int i = 0; i < 5; i++)
	{
		_enemigo_amigo = new Matusquela(_working_surface, "1",50, 50,0);
		_wave->enemiesList.push_back(_enemigo_amigo);

	}

	for(int i = 0; i < 8; i++)
	{
		_enemigo_amigo1= new Matusquela(_working_surface, "1",20, 40,0);
		_wave2->enemiesList.push_back(_enemigo_amigo1);

	}


	for(int i = 0; i < 15; i++)
	{
		_enemigo_amigo2= new Matusquela(_working_surface, "1",30, 30,0);
		_wave3->enemiesList.push_back(_enemigo_amigo2);

	}

	_wave->_canonical_name = "Wave";
	_wave2->_isActive = false;
	_wave3->_isActive = false;

	_waveHolder->waveVactor.push_back(_wave);
	_waveHolder->waveVactor.push_back(_wave2);
	_waveHolder->waveVactor.push_back(_wave3);


	//objList.push_back(_wave2);
	//objList.push_back(_wave);

	objList.push_back(_waveHolder);

	//inicio tragetoria fase 2
	//_enemigo_amigo = new Matusquela(_working_surface, "1",781, 147);

	//inicio tragetoria 1 fase 3
	//_enemigo_amigo = new Matusquela(_working_surface, "1", 605, 9);

	//inicio tragetoria 2 fase 3
	//_enemigo_amigo = new Matusquela(_working_surface, "1", 8, 2);

	//inicio tragetoria 1 fase 4
	//_enemigo_amigo = new Matusquela(_working_surface, "1", 3, 106);

	//inicio tragetoria 2 fase 4
	//_enemigo_amigo = new Matusquela(_working_surface, "1", 788, 423);

	//inicio de todas as tragetorias da fase 5
	//_enemigo_amigo = new Matusquela(_working_surface, "1", 6, 426);

	//inicio 1 fase 6
	//_enemigo_amigo = new Matusquela(_working_surface, "1", 646, 2);

	//inicio 2 fase 6
	//_enemigo_amigo = new Matusquela(_working_surface, "1", 787, 264);

	//inicio 3 fase 6
	//_enemigo_amigo = new Matusquela(_working_surface, "1", 3, 273);

	//_wave->enemiesList.push_back(_enemigo_amigo1);

	return true;
}





